package com.laijiale.dto;

import com.laijiale.constant.RE;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import java.io.Serializable;

import static com.laijiale.constant.RE.*;

/**
 * @author laijiale
 * @date 2025年01月09日 14:28
 */
 @Schema(name ="课程修改DTO")
 @Data
 public class CourseUpdateDTO implements Serializable, RE {
    @NotNull(message = "主键不能为空")
    @Schema(description = "主键")
    private Long id;
    @Pattern(regexp = TITLE_RE, message = TITLE_RE_MSG)
    @Schema(description = "标题")
    private String title;
    @Pattern(regexp = AUTHOR_RE, message = AUTHOR_RE_MSG)
    @Schema(description = "作者")
    private String author;
    @Schema(description = "类别ID，类别表外键")
    private Long fkCategoryId;
    @Pattern(regexp = INFO_RE, message = INFO_RE_MSG)
    @Schema(description = "描述")
    private String info;
    @Range(min = 0, message = "单价最少为o")
    @Schema(description = "单价，单位元")
    private Double price;
    @Range(min = 0, message = "序号最小为o")
    @Schema(description = "序号")
    private Long idx;
}
